//index.js
//获取应用实例
const app = getApp()
import {
  request
} from "../../request/request.js"
Page({
  data: {
  title:'搜索',
  swiper_list:[],// 轮播图的数据
  catItems:[],
  floorData:[]
  },
  //事件处理函数
  bindViewTap: function() {
    wx.navigateTo({
      url: '../logs/logs'
    })
  },
  onLoad: function () {
   this.getSwiperList()
   this.getCatItems()
   this.getFloorData()
  },
  // 轮播图
  getSwiperList:async function(e){
    const swiper_list = await request({
      url:"/home/swiperdata"
    })
    this.setData({
      swiper_list
    })
    console.log(swiper_list);
  },
  // 分类导航数据
  getCatItems:async function(e){
    const catItems = await request({
      url:"/home/catitems"
    })
    this.setData({
      catItems
    })
    console.log(catItems);
  },
  getFloorData:async function(e){
    const floorData = await request({
      url:"/home/floordata"
    })
    console.log(floorData);
    this.setData({
      floorData
    })
    
  },
  getUserInfo: function(e) {
    console.log(e)
    app.globalData.userInfo = e.detail.userInfo
    this.setData({
      userInfo: e.detail.userInfo,
      hasUserInfo: true
    })
  }
})
